package com.lang.actions;

import org.apache.struts2.ServletActionContext;

import com.lang.service.TaskService;
import com.opensymphony.xwork2.Action;

public class TaskAction implements Action{

	private TaskService taskservice;
	private String result;

	public TaskService getTaskservice() {
		return taskservice;
	}

	public void setTaskservice(TaskService taskservice) {
		this.taskservice = taskservice;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * 登记包裹异常信息
	 * @return
	 * @author Lang
	 */
	public String updateTask(){
		String tid = ServletActionContext.getRequest().getParameter(
				"taskid");
		String c = ServletActionContext.getRequest().getParameter(
				"comment");
		String type = ServletActionContext.getRequest().getParameter(
				"type");
		System.out.println("taskid="+tid);
		System.out.println("comment="+c);
		System.out.println("type="+type);
//		String r="";
		String r=taskservice.updateTask(tid, c,type);//type 成功还是异常
		if("success".equals(r)){
			result="{result:\"success\"}";
		}
		return "result";
	}

}
